'''
Created on Sep 14, 2011

@author: nktran
'''
import os
import sys

from constant import QUERY_FILE, FSA_FILE, TABLE_FILE
from algorithm import Angluin

if __name__ == '__main__':
    
    if len(sys.argv) < 2:
        print "\nUsage: python run.py [extension]"
        sys.exit(1)
        
    runner = Angluin()
    
    if QUERY_FILE + sys.argv[1] in os.listdir("."):
        os.remove(QUERY_FILE + sys.argv[1])
    if FSA_FILE + sys.argv[1] in os.listdir("."):
        os.remove(FSA_FILE + sys.argv[1])
    if TABLE_FILE + sys.argv[1] in os.listdir("."):
        os.remove(TABLE_FILE + sys.argv[1])
                      
    runner.learn(sys.argv[1])